﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using Ninject.Web;
using Ninject;
using Legazpi.Payroll.BusinessLogic.Services.Interfaces;
using Newtonsoft.Json;

namespace Legazpi.Payroll.Web.Webservices
{
    /// <summary>
    /// Summary description for UserWebService
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    // [System.Web.Script.Services.ScriptService]
    public class UserWebService : WebServiceBase
    {

        [Inject]
        public IUserService _userService { get; set; }

        [WebMethod]
        public string DeleteUser(int Id)
        {
            //string userName = UserHelper.ValidateAndGetUserName();

            _userService.Delete(Id);
            var status = _userService.Save();
            string json = JsonConvert.SerializeObject(new { Success = status });
            return json;
        }
    }
}
